home *** CD-ROM | disk | FTP | other *** search
- /*
- File: GMTTime.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __GMTTIME__
- #define __GMTTIME__
-
- #ifndef __DIRECTOBJECT__
- #include "DirectObject.h"
- #endif
-
- class ostream;
- class TAbstractFile;
-
- /***********************************|****************************************/
-
- typedef unsigned long Time; // seconds since 1/1/1904
- typedef short TimeZone; // minutes offset from GMT
-
- class TTimeStamp : public TDirectObject
- {
- public:
-
- TTimeStamp ();
- virtual ~TTimeStamp ();
-
- TTimeStamp& operator = ( const TTimeStamp& );
- Boolean operator == ( const TTimeStamp& ) const;
- Boolean operator != ( const TTimeStamp& ) const;
-
- operator Time () const;
-
- void SetToLocalTime ();
- void ConvertToZone ( TimeZone );
-
- char* CreateString () const;
- unsigned long GetStringLength () const;
- void MakeString ( char* buffer, unsigned long size ) const;
-
- virtual Boolean WriteTo ( TAbstractFile& ) const;
- virtual Boolean ReadFrom ( TAbstractFile& );
-
- virtual ostream& operator >> ( ostream& ) const;
-
- protected:
-
- static TimeZone GetLocalZone ();
- static Time GetLocalTime ();
- static Time GetZoneDifference ( const TimeZone local, const TimeZone reference );
-
- private: Time fOriginTime;
- TimeZone fOriginZone;
- };
-
- /***********************************|****************************************/
-
- extern unsigned long GetCurrentGMTSeconds ();
- extern long GetLocalOffsetEastOfGMTInSeconds (); // negative for values west of GMT
- extern unsigned long ConvertGMTSecondsToLocalSeconds ( unsigned long gmtSeconds );
- extern unsigned long ConvertLocalSecondsToGMTSeconds ( unsigned long localSeconds );
-
- /***********************************|****************************************/
-
- #endif // __GMTTIME__
-